home *** CD-ROM | disk | FTP | other *** search
/ c't freeware shareware 1997 / CT_SW_97.ISO / mac / Software / entwickl / macos / showicn.hqx / ShowInitIcon / Usage & History < prev    next >
Text File  |  1995-05-30  |  2KB  |  34 lines

  1. // ----------------------------------------------------------------------------------------------------------------
  2.  
  3. Should I use it as a standalone code resource or link it into my INIT?
  4.  
  5. I recommend linking the code to your INIT resource, because it's easier and cleaner, *provided* that your INIT resource is
  6. written properly, that is, it is destroyed once startup is over. If your INIT installs trap patches, then the code for the trap
  7. patches should be compiled into a separate resource (or code fragment, on the PowerPC) and only the code for the patches
  8. should remain resident. Filling the System heap with old INIT code isn't cool.
  9.  
  10. If you decide to use this code as a standalone resource, here is a snippet that shows how to load and call it:
  11.  
  12. Handle        theResource;
  13.  
  14. theResource = Get1Resource('Code', 7000);
  15. if (theResource)
  16.     ((pascal void (*) (short, Boolean)) *theResource) (myIconFamilyID, true);
  17.  
  18. Note that I don't call HLock because the resource is marked as Locked, and I don't call ReleaseResource because the 
  19. INIT resource file is going to be closed after the INIT executes, unloading all resources.
  20.  
  21. // ----------------------------------------------------------------------------------------------------------------
  22.  
  23. History:
  24.  
  25. 1.0        Initial release
  26. 1.0.1    Modified to work with MPW C compiler (replaced variables at absolute address with macros)
  27.         Removed dependency on precompiled headers
  28.         Thanks to Devon Hubbard, Martin Minow, Jason Proctor.
  29.  
  30. // ----------------------------------------------------------------------------------------------------------------
  31.  
  32. François Pottier <pottier@dmi.ens.fr>
  33. May 30th, 1995
  34.